-
-
Notifications
You must be signed in to change notification settings - Fork 372
fix: Use correct parsing for stackframes #6908
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
73c4c82 to
3985141
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6908 +/- ##
=============================================
- Coverage 85.076% 85.037% -0.039%
=============================================
Files 453 455 +2
Lines 27674 27690 +16
Branches 12166 12160 -6
=============================================
+ Hits 23544 23547 +3
- Misses 4087 4099 +12
- Partials 43 44 +1
... and 42 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
3985141 to
ced502e
Compare
Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 762a701 | 1225.95 ms | 1244.49 ms | 18.54 ms |
| 61414e8 | 1225.49 ms | 1254.28 ms | 28.79 ms |
| 588dd7c | 1235.11 ms | 1241.76 ms | 6.65 ms |
| f5666e7 | 1227.08 ms | 1260.18 ms | 33.10 ms |
| b9aacb6 | 1230.42 ms | 1251.00 ms | 20.58 ms |
| 16f6edc | 1234.02 ms | 1269.67 ms | 35.65 ms |
| b709887 | 1193.52 ms | 1216.74 ms | 23.22 ms |
| 5fc3364 | 1222.36 ms | 1252.33 ms | 29.96 ms |
| 1fe932f | 1231.92 ms | 1253.44 ms | 21.52 ms |
| 80538ca | 1216.70 ms | 1253.92 ms | 37.22 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 762a701 | 23.75 KiB | 1022.78 KiB | 999.03 KiB |
| 61414e8 | 23.75 KiB | 867.69 KiB | 843.94 KiB |
| 588dd7c | 23.75 KiB | 938.33 KiB | 914.58 KiB |
| f5666e7 | 23.75 KiB | 963.18 KiB | 939.43 KiB |
| b9aacb6 | 23.75 KiB | 913.64 KiB | 889.89 KiB |
| 16f6edc | 23.74 KiB | 1022.94 KiB | 999.19 KiB |
| b709887 | 23.75 KiB | 1.01 MiB | 1016.14 KiB |
| 5fc3364 | 23.75 KiB | 1.00 MiB | 1006.00 KiB |
| 1fe932f | 23.75 KiB | 913.63 KiB | 889.88 KiB |
| 80538ca | 23.75 KiB | 989.99 KiB | 966.24 KiB |
Previous results on branch: mxRewriting
Startup times
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 44da6c5 | 1234.22 ms | 1266.02 ms | 31.80 ms |
| 8824c94 | 1226.98 ms | 1262.65 ms | 35.67 ms |
| c5b3f7a | 1220.18 ms | 1259.44 ms | 39.25 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 44da6c5 | 24.14 KiB | 1.03 MiB | 1.00 MiB |
| 8824c94 | 24.14 KiB | 1.01 MiB | 1014.88 KiB |
| c5b3f7a | 24.14 KiB | 1.01 MiB | 1013.45 KiB |
d978079 to
169cf94
Compare
432f4ad to
a7949ab
Compare
a7949ab to
0c4f788
Compare
0c4f788 to
db09d78
Compare
| // that just contains the most common callstack. | ||
| func sentryMXBacktrace(inAppLogic: SentryInAppLogic?, handled: Bool) -> [SentryThread] { | ||
| callStacks.map { callStack in | ||
| let thread = SentryThread(threadId: 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: All threads incorrectly assigned thread ID 0
In sentryMXBacktrace(), all threads are assigned threadId: 0 regardless of their position in the callStacks array. The old Objective-C code used an incrementing counter to assign unique thread IDs (@(i)). When callStackPerThread is true (e.g., for crash diagnostics), multiple call stacks represent different threads and need distinct IDs. Using callStacks.enumerated().map would provide the index needed for unique thread IDs.
Fixes #4040
The problem was that for some events such as app hangs and CPUDiagnostics the metric kit payload contains an entire flamegraph. This change parses the flame graph into samples, and then picks the longest duration sample as the one we use for a stack trace. It also fixes over-counting the CPUDiagnostics which was emitting more than one event per exception. This is also fixed by identifying the longest duration sample.
Eventually we should support showing the full flame graph on the frontend, but with this PR the bug is fixed and we can consider that a future improvement.
I tested this on test flight by triggering crashes and verifying they are still correct